import antfu from '@antfu/eslint-config'

export default antfu({
  // TypeScript and Vue are auto-detected, you can also explicitly enable them:
  typescript: true,
  vue: true,

  ignores: ['node_modules/*', '**/.eslintrc.js', '!**/.build', '.build/*', '!.build/test.js', '**/dist', '**/*.html', '**/uni_modules/', '**/*.d.ts', '*.d.ts'],
  languageOptions: {
    globals: {
      process: true,
    },
  },
  overrides: {
    vue: { 'vue/component-name-in-template-casing': ['off'] },
  },
  rules: {
    'vue/multi-word-component-names': 0,
    'vue/html-self-closing': [
      'error',
      {
        html: {
          void: 'always',
          normal: 'never',
          component: 'always',
        },
        svg: 'always',
        math: 'always',
      },
    ],
    'semi': [2, 'never'],
    'semi-spacing': [
      2,
      {
        before: false,
        after: true,
      },
    ],
    'no-console': 0,
    'style/arrow-parens': [0, 'as-needed'],
    'style/comma-dangle': 0,
    'antfu/if-newline': 'off',
    'eqeqeq': [2, 'always'],
    'vue/block-order': [
      'error',
      {
        order: [['script', 'template'], 'style'],
      },
    ],
    'no-var': 1,
    'no-const-assign': 2,
    'no-undef': 2,
    'no-undef-init': 0,
    'no-unsafe-finally': 2,
    'accessor-pairs': 2,
    'arrow-spacing': [
      2,
      {
        before: true,
        after: true,
      },
    ],
    'comma-spacing': [
      2,
      {
        before: false,
        after: true,
      },
    ],
    'keyword-spacing': [
      2,
      {
        before: true,
        after: true,
      },
    ],
    'vue/first-attribute-linebreak': [
      2,
      {
        singleline: 'beside',
        multiline: 'beside',
      },
    ],
    'vue/max-attributes-per-line': [
      2,
      {
        singleline: 6,
        multiline: {
          max: 6,
        },
      },
    ],
    'no-unused-vars': [1, { destructuredArrayIgnorePattern: '^_' }],
    'unused-imports/no-unused-vars': [0, { argsIgnorePattern: '^_' }],
    'vue/no-async-in-computed-properties': 'error',
    'vue/no-dupe-keys': 'error',
    'vue/no-v-for-template-key': 'off',
    'vue/no-duplicate-attributes': 'error',
    'vue/no-parsing-error': [
      'error',
      {
        'x-invalid-end-tag': false,
      },
    ],
    'vue/no-reserved-keys': 'error',
  },
})
